package action.user;

import action.BaseAction;
import service.UserService;
import util.ObjectFactory;

public class CheckLoginAction extends BaseAction{
	//input
	private String name;
	private String password;
	//output
	private String login_error;
	//injection
	private UserService userService;
	public void setUserService(UserService userService) {
		this.userService = userService;
	}
	
	public String execute() throws Exception{ 
		String result =userService.checkLogin(name, password,session,httpReq);
		if (result.equals("verify")) {
			return "verify";
		}else if (result.equals("success")) {
			return "success";
		}else {
			login_error="用户名或密码错误";
			return "error";
		}
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getLogin_error() {
		return login_error;
	}

	public void setLogin_error(String loginError) {
		login_error = loginError;
	}
	
}
